package com.jhg.drgclinicalpathway.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jhg.drgclinicalpathway.domain.YB_MSG;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;
@Mapper
public interface YbMsgDao extends BaseMapper<YB_MSG> {
    @Insert({"insert into YB_MSG (zt,cjsj,jzh,send,anser,msg) values(#{zt},#{cjsj},#{jzh},#{send},#{anser},#{msg})"})
    public int inserts(YB_MSG msg);
    @Select({"SELECT a.住院号,a.床号, a.病人姓名,case when a.在院=1 then '在院' else '出院' end 在院状态,b.* from [VDCP_病人信息] a, YB_MSG b " +
            "where a.病人ID=b.jzh and b.Anser=#{jsr}"})
    public List<Map<String, Object>> getMsgByjsr(@Param("jsr") String jsr);
    @Select({"select * from YB_MSG where Anser=#{jsr} and zt=#{zt} "})
    public List<Map<String, Object>> getMsgByjsrZt(@Param("jsr") String jsr,@Param("zt") String zt);
    @Select({"select * from YB_MSG where send=#{fsr} and jzh=#{jzh} order by id desc"})
    public List<Map<String, Object>> getMsgByfsr(@Param("fsr") String fsr, @Param("jzh") String jzh);

}
